﻿using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.Environment.Extensions;

namespace OrchardHUN.QnA.Extensions
{
    [OrchardFeature("OrchardHUN.QnA")]
    public static class ContentPartIEnumerableExtensions
    {
        public static ContentPart GetPart<T>(this IEnumerable<T> parts, string name)
            where T : ContentPart
        {
            return parts.Where(part => part.PartDefinition.Name == name).First();
        }
    }
}